#from core import src
from DB import db_hand

def register_info(user_name,password):
    user_data={
        'user_name':user_name,
        'password':password,
        'money':100000,
        'account':[],
    }
    user=db_hand.get_data(user_name)
    if user:
        return False,f'用户已存在'
    db_hand.save_data((user_data))
    return True,f'{user_name}用户注册成功'


def login_info(user_name,password):
    user_data=db_hand.get_data(user_name)
    if user_data:
        if password==user_data['password']:
            return True,'登录成功'

        return False,'登录失败，密码错误，请重新输入'
    return False ,'登录失败，该用户不存在'




